import request from '@/utils/request'

export const queryGoodsList = (data) => request({ method: 'post', url: '/api/query/goods', data })

export const queryMultipart = (params) => request({ method: 'get', url: '/my/query/info', params })

export const queryLogin = (data) => request({ method: 'post', url: '/api/login', data })
// 注册
export const queryRegister = (data) => request({ method: 'post', url: '/api/register', data })
// 更新信息
export const queryInfo = (yarn, month, day, data) => request({ method: 'post', url: `my/update/info/${yarn}/${month}/${day}`, data })
// 修改头像
export const queryAvatar = (data) => request({ method: 'post', url: '/my/modifyAvatar', data })

export const queryGrounding = (data) => {
  return request({
    method: 'post',
    url: '/api/time/goods/list',
    data
  })
}

export const reqDetails = (Id) => request({ method: 'get', url: `/api/query/goodsList/${Id}` })

export const queryVolume = (data, rule) => {
  return request({
    method: 'post',
    url: `/api/volume/goods/list/${rule}`,
    data
  })
}

export const queryPrice = (data, asc) => {
  return request({
    method: 'post',
    url: `/api/price/goods/list/${asc}`,
    data
  })
}

export const queryKey = (data) => {
  return request({
    method: 'post',
    url: '/api/key/goods/list',
    data
  })
}

export const queryKeyPrice = (data) => {
  return request({
    method: 'post',
    url: '/api/price/goods/list',
    data
  })
}

export const queryPriceOrPrice = (data) => {
  return request({
    method: 'post',
    url: '/api/priceOrPrice/goods/list',
    data
  })
}
export const queryAll = () => {
  return request({
    method: 'get',
    url: '/api/all/goods/list'
  })
}

export const queryMy = () => {
  return request({
    method: 'get',
    url: '/my/query/shopping/cart'
  })
}

export const queryRemove = (id) => {
  return request({
    method: 'post',
    url: `/my/remove/shopping_cart/${id}`
  })
}

export const queryCart = (id, num) => {
  return request({
    method: 'post',
    url: `/my/cart/addCart/${id}/${num}`
  })
}

export const queryProvince = () => {
  return request({
    method: 'get',
    url: '/my/query/province'
  })
}

export const queryStatus = (data) => {
  return request({
    method: 'post',
    url: '/my/status/shopping_cart',
    data
  })
}

export const queryAddQuery = (id, data) => {
  console.log(id, data)
  return request({
    method: 'post',
    url: `/my/addQuery/order/${id}`,
    data
  })
}

export const queryAddShopping_cart = (id) => {
  return request({
    method: 'post',
    url: `/my/add/shopping_cart/${id}`
  })
}

export const queryOrder = (data) => {
  return request({
    method: 'get',
    url: '/my/query/order',
    data
  })
}

export const queryProvinceOrder = (id) => {
  return request({
    method: 'post',
    url: `/my/query/province/order/${id}`
  })
}

export const queryHotSort = (data) => {
  return request({
    method: 'GET',
    url: '/api/query/hotSort',
    data
  })
}

export const queryFollow = (data) => {
  return request({
    method: 'GET',
    url: '/my/query/follow',
    data
  })
}

export const queryRemoveFollow = (id) => {
  return request({
    method: 'post',
    url: `/my/remove/follow/${id}`
  })
}

export const queryAddFollow = (id, time) => {
  console.log(time)
  return request({
    method: 'post',
    url: `/my/add/follow/${id}`,
    data: { time: time }
  })
}

export const queryClickTab = (data) => {
  return request({
    method: 'post',
    url: '/api/clickTab/goods/list',
    data
  })
}

export const queryConsignee = (data) => {
  return request({
    method: 'get',
    url: '/my/query/consignee/info',
    data
  })
}

export const queryDelete = (id) => {
  return request({
    method: 'post',
    url: `/my/delete/consignee/${id}`
  })
}

export const queryAdd = (data) => {
  return request({
    method: 'post',
    url: '/my/add/consignee',
    data
  })
}

export const queryUpdate = (id, data) => {
  return request({
    method: 'post',
    url: `/my/update/consignee/info/${id}`,
    data
  })
}

export const queryIsDefault = (id) => {
  return request({
    method: 'post',
    url: `/my/update/consignee/isDefault/${id}`
  })
}

export const queryClickTabList = (data) => {
  return request({
    method: 'post',
    url: '/api/clickTab/goods/list',
    data
  })
}

export const queryCancel = (id) => {
  return request({
    method: 'post',
    url: `/my/cancel/Order/${id}`
  })
}
